<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><%= web_title%></title>
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="/ruoling/css/ruoling-ui.css">
    <link rel="stylesheet" href="/ruoling/css/ruoling-load.css">
    <link rel="stylesheet" href="/libs/Tree/layui_ext/dtree/dtree.css">
    <link rel="stylesheet" href="/libs/Tree/layui_ext/dtree/font/dtreefont.css">
</head>
<style>
    .Yiling-flexd{position: fixed;bottom: 0;background-color: #f0f4f7;width: 100%;border-top: 1px #c7c7c7 solid;text-align: right;}
    .Yiling-padding{padding: 20px 15px;}
    .Yiling-border-blue{border: 1px solid #0064b6;}
    .Yiling-border-block{border: 1px solid #000;}
    .Yiling-Body{background-color: #ffffff;}
    .Yiling-padding-bottom{padding-bottom: 5px;}
    .Yiling-seach{display: inline-block;height: 36px;border: 1px solid #e5e6e7;vertical-align: top;line-height: 36px;width: 36px;text-align: center;margin-left: -6px;border-top-right-radius: 5px;border-bottom-right-radius: 5px;cursor: pointer;}
</style>
<body class="Yiling-Body">
  <div style="padding:20px 20px;">
    <form class="layui-form" action="">
        <div class="Yiling-padding-bottom" >
            <label class="layui-form-label" style="width: 60px;">关键字：</label>
            <div style="width: 200px;display: inline-block;">
                <input type="text" id="Pidtitle" name="Pidtitle" style="background-color: #f8f8f8;width: 200px;" required  lay-verify="required" placeholder="请输入关键字" autocomplete="off" class="layui-input">
            </div>
            <div class="Yiling-seach">
                <i class="layui-icon layui-icon-search"></i>   
            </div>
            <ul id="objTree" class="dtree" style="padding-top: 5px;" data-id="0"></ul>
        </div>
    </form>
  </div>
  <div class="Yiling-flexd">
    <div class="Yiling-padding">
        <button type="button" id="Yiling-Affirm" class="layui-btn layui-btn-sm Yliing-blue Yiling-border-blue">确认</button>
        <button type="button" id="Yiling-close" class="layui-btn layui-btn-sm layui-btn-primary  Yiling-border-block">关闭</button>
    </div>
  </div>
</body>
</html>
<script src="/layuiadmin/layui/layui.js"></script>
<script>

layui.config({
    base:'/libs/Tree/layui_ext/dtree/'
}).use(["table","layer","jquery","dtree"],function(){
    let table = layui.table;
    let layer = layui.layer;
    let $ = layui.jquery;
    let dtree = layui.dtree;

    dtree.render({
        elem:"#objTree",
        dataStyle: "layuiStyle",  //使用layui风格的数据格式
        method: "get",
        dataFormat: "list",  //配置data的风格为list
		response:{message:"msg",statusCode:0},  //修改response中返回数据的定义
        url:"/admin/v1/api/system/menu/tree",
    });
        /**
     * 点击子节点触发
     * **/
    dtree.on("node(objTree)",function(obj){
        let dtdata = {
            title:obj.param.context,
            id:obj.param.nodeId
        } 
        /**
        * 
         * 确认按钮
        */
        let Yiling_Affirm = document.querySelector("#Yiling-Affirm");
        Yiling_Affirm.addEventListener("click",function(){
            parent.window[0].Loadinput(dtdata);
            //获取特定iframe层的索引
            let index = parent.layer.getFrameIndex(window.name);  
            parent.layer.close(index);
        });
    })

    // 关闭按钮事件
    let Yiling_close = document.querySelector("#Yiling-close");
    Yiling_close.addEventListener("click",function(){
        //获取特定iframe层的索引
        let index = parent.layer.getFrameIndex(window.name);  
        parent.layer.close(index);
    });
})
</script>
<!-- 时间格式化 -->
<script type="text/html" id="SetDateCrete">
    {{FormDate(d.creationtime,"yyyy年MM月dd日 HH:mm:ss")}}
</script>
<script>
    function FormDate(d,str){
        return layui.util.toDateString(d, str)
    }
</script>